/*科研管理员审核 */
<template>
  <div style="color: #ebebeb;height:1000px">
    <el-row>
        <el-col :span="24">
                <el-card class="box-card">
                    <div class="text item">
                        <el-row class="el-row_color">
                        <el-col :span="24">
                            <span style="color:blue;font-size: 20px;">审核</span>
                        </el-col>
                        </el-row>
                        <br/>
                        <hr/>
                        <el-row class="el-row_color">
                        <el-col :span="24">
                            <span style="color:blue;font-size: 15px;">审核</span>
                        </el-col>
                        </el-row>
                        <br/>
                        <el-row class="el-row_color">
                          <el-col :span="24">
                            <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" @selection-change="handleSelectionChange">
                              <el-table-column prop="expenditureMoney" label="总经费(万元)"></el-table-column>
                              <el-table-column prop="accounting" label="到账总经费(元)"></el-table-column>
                              <el-table-column prop="billingTime" label="到账时间"></el-table-column>
                            </el-table>
                          </el-col>
                        </el-row>
                        <br/>
                        <el-row class="el-row_color">
                                  <el-col :span="2">
                                        <div>
                                            <span>结果类型：</span>
                                        </div>
                                    </el-col>
                                    <el-col :span="22">
                                        <el-select v-model="Info.Outcome" @change="GetOption()">
                                            <el-option
                                            v-for="item in AduitResultOptions"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value"
                                            
                                            ></el-option> </el-select
                                        >
                                    </el-col>
                        </el-row>
                        <br/>
                        <el-row class="el-row_color">
                            <el-col :span="24">
                                <div v-show="Info.Outcome==true">
                                    <el-row>
                                        <el-col :span="2">
                                            <div>
                                                <span>通过原因：</span>
                                            </div>
                                        </el-col>
                                        <el-col :span="20">
                                            <el-input type="textarea" rows="5" v-model="Info.remark"></el-input>
                                        </el-col>
                                    </el-row>
                                </div>
                                <div v-show="Info.Outcome==false">
                                    <el-row>
                                        <el-col :span="2">
                                            <div>
                                                <span>退回步骤：</span>
                                            </div>
                                        </el-col>
                                        <el-col :span="20">
                                            <el-select v-model="Info.orderId">
                                                <el-option
                                                v-for="item in AduitStepOptions"
                                                :key="item.orderId"
                                                :label="item.stepName"
                                                :value="item.orderId"
                                                ></el-option>
                                            </el-select>
                                        </el-col>
                                    </el-row>
                                    <br/>
                                    <el-row>
                                        <el-col :span="2">
                                            <div>
                                                <span>退回原因：</span>
                                            </div>
                                        </el-col>
                                        <el-col :span="20">
                                            <el-input type="textarea" rows="5" v-model="Info.remark"></el-input>
                                        </el-col>
                                    </el-row>
                                </div>
                            </el-col>
                        </el-row>
                    </div>
                </el-card>
                 <br/>
                <el-row style="margin-left: 1000px;">
                    <el-col :span="24">
                        <el-form-item>
                            <el-button type="primary" @click="submitForm()">保存</el-button>
                        </el-form-item>
                    </el-col>
                </el-row>
        </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  props: { id: undefined ,stepId:undefined},
  data() {
    return {
        tableData:[],
        Info:{
            projectId:this.$route.query.id,             //经费分配主键
            Outcome:'',                                 //结果类型
            remark:'',                                  //通过原因、退回原因
            orderId:'',                                 //退回步骤(返回的节点)
            auditStepId:this.$route.query.stepId,       //审核的节点
        },
        AduitResultOptions: [
        {
          label: "通过",
          value: true,
        },
        {
          label: "退回",
          value: false,
        },
      ],
      AduitStepOptions: [],
    }
  },
  created() {
    this.dataedit()
  },
  methods: {
    GetOption(){
      this.GetReturnWorkFlowStep();
    },
    GetReturnWorkFlowStep()
    {
      let id = this.$route.query.id;
      this.http.get('api/tb_project_workflowstep/GetReturnWorkFlowStep?projectId='+id+'&stepId='+ this.$route.query.stepId).then(
            (res)=>{
                if(res.status)
                {
                  this.AduitStepOptions = res.result.data;
                  console.log(this.AduitStepOptions);
                }
            }
        ) 
    },
    submitForm(){
        // let allocationId=localStorage.id;
        // this.Info.allocationId=allocationId
        var id=localStorage.id
        this.http.post("api/tb_project_workflowstep/WorkFlowStepAddTs",this.Info).then((res=>{
            if(res.status){
                //弹出提示信息
                this.$message.success('审核结束！正在跳转页面');
                this.$router.push('/tb_project_billing_allocationList?id='+id)
            }
            else{
                this.$message.error('审核出错了！请重试！！');
            }
        }))
    },
    //详情
    dataedit() {
      this.http
        .get("/api/tb_project_billing_allocation/billingAllocationDetail?id=" + this.$route.query.id)
        .then((res) => {
          this.tableData = res.data;
        });
    },
  },
}
</script>

<style>
.el-row_color{
    margin-left: 30px;
    
}
</style>
